#pragma once
#include "../lib3dw/HUDElement.h"
#include "../lib3dw/PNGTexture.h"
#include "../lib3dw/ConfigSingleton.h"

#include <string>
#include <sstream>
#include <vector>
#include <list>

using namespace lib3dw;

namespace Dicewars
{
	typedef enum PlayerType {HumanPlayer, ComputerPlayer};
	typedef struct {std::vector<int> dice; int strength; float color[3];} GameStatus;
	
	class StatusBar : public HUDElement
	{
		public:
			StatusBar(void);
			~StatusBar(void);
			void Draw();
			void SetTimeCounterValue(int value);
			void SetDiceCounterValues(GameStatus att, GameStatus def);
			void SetTimeCounterColor(const float r, const float g, const float b);
			void SetFPS(float fps);
			void SetPlayerType(PlayerType newPlayerType);
			void CreatePlayerIndicator();
			void SetActivePlayeryType(PlayerType newPlayerType);

		private:
			void DrawText(std::string name, std::string value, float positionX, float positionY);
			void DrawText(std::string name, int value, float positionX, float positionY);
			void SetOrtho();
			void CreateBar();
			void CreateTimeCounter();
			void CreateDiceCounter();
			void ResetView();
			int currentCounterValue;
			int result;			
			GameStatus attackResult;
			GameStatus defendResult;
			std::vector<int>::const_iterator diceIterator;
			PNGTexture* diceTextures;
			std::vector<PNGTexture*> textures;
			PNGTexture* cpuIndicator;
			PNGTexture* userIndicator;
			PlayerType playerType;
			unsigned long width;
			unsigned long height;
			float attackerColor[3];
			float defenderColor[3];
			float counterColor[3];
			float FPS;
	};
}